package user.controller;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import user.model.Shop;

@Component("user.controller.UpdateController")
@Controller
public class UpdateController {
    
	@Autowired
	private Shop shop;
	
	@RequestMapping("/update.spr")
	public void execute(HttpServletRequest request) throws UnsupportedEncodingException{
	  
	   String b_jemok=request.getParameter("b_jemok");
	   String num=request.getParameter("num");
	   String snum=request.getParameter("snum");
	   String tablename=request.getParameter("tablename");
	   tablename=tablename.replaceAll(" ", "_");
	   //System.out.println("snum:"+snum);
	   shop.update(b_jemok, num, snum, tablename);
	}
	@RequestMapping("/nameupdate.spr")
	public void execute1(HttpServletRequest request) throws UnsupportedEncodingException{
	  
	   String b_name=request.getParameter("b_name");
	   String num=request.getParameter("num");
	   String snum=request.getParameter("snum");
	   String tablename=request.getParameter("tablename");
	   tablename=tablename.replaceAll(" ", "_");
	   //System.out.println(snum);
	   shop.nameupdate(b_name, num, snum, tablename);
	}
	@RequestMapping("/companyupdate.spr")
	public void execute2(HttpServletRequest request) throws UnsupportedEncodingException{
	  
	   String b_company=request.getParameter("b_company");
	   String num=request.getParameter("num");
	   String snum=request.getParameter("snum");
	   String tablename=request.getParameter("tablename");
	   tablename=tablename.replaceAll(" ", "_");
	   shop.companyupdate(b_company, num, snum,tablename);
	}
	@RequestMapping("/isbnupdate.spr")
	public void execute3(HttpServletRequest request) throws UnsupportedEncodingException{
	  
	   String b_isbn=request.getParameter("b_isbn");
	   String num=request.getParameter("num");
	   String snum=request.getParameter("snum");
	   String tablename=request.getParameter("tablename");
	   tablename=tablename.replaceAll(" ", "_");
	   shop.isbnupdate(b_isbn, num, snum, tablename);
	}
	
}
